#! /bin/sh /usr/share/dpatch/dpatch-run
## 02_rename_lapack_atlas.dpatch.dpatch by  <david@evans>
##
## All lines beginning with `## DP:' are a description of the patch.
## DP: Rename ATLAS incomplete lapack to lapack_atlas.

@DPATCH@
diff -urNad atlas-3.8.3~/CONFIG/src/SpewMakeInc.c atlas-3.8.3/CONFIG/src/SpewMakeInc.c
--- atlas-3.8.3~/CONFIG/src/SpewMakeInc.c	2009-08-22 16:02:46.000000000 -0700
+++ atlas-3.8.3/CONFIG/src/SpewMakeInc.c	2009-08-22 21:27:35.000000000 -0700
@@ -532,7 +532,7 @@
       fprintf(fpout, "   PTCBLASlib = $(LIBdir)/libptcblas.a\n");
       fprintf(fpout, "   PTF77BLASlib = $(LIBdir)/libptf77blas.a\n");
    }
-   fprintf(fpout, "   LAPACKlib = $(LIBdir)/liblapack.a\n");
+   fprintf(fpout, "   LAPACKlib = $(LIBdir)/liblapack_atlas.a\n");
    fprintf(fpout, "   TESTlib = $(LIBdir)/libtstatlas.a\n\n");
 
    fprintf(fpout, "#  -------------------------------------------\n");
diff -urNad atlas-3.8.3~/Make.top atlas-3.8.3/Make.top
--- atlas-3.8.3~/Make.top	2009-08-22 16:02:46.000000000 -0700
+++ atlas-3.8.3/Make.top	2009-08-22 21:27:35.000000000 -0700
@@ -291,8 +291,8 @@
 install_lib:
 	cp $(LIBdir)/libatlas.a $(INSTdir)/.
 	cp $(LIBdir)/libcblas.a $(INSTdir)/.
-	cp $(LIBdir)/liblapack.a $(INSTdir)/.
-	chmod 0644 $(INSTdir)/libatlas.a  $(INSTdir)/liblapack.a \
+	cp $(LIBdir)/liblapack_atlas.a $(INSTdir)/.
+	chmod 0644 $(INSTdir)/libatlas.a  $(INSTdir)/liblapack_atlas.a \
                    $(INSTdir)/libcblas.a 
 	- cp $(LIBdir)/libf77blas.a $(INSTdir)/.
 	- chmod 0644 $(INSTdir)/libf77blas.a
diff -urNad atlas-3.8.3~/makes/Make.lib atlas-3.8.3/makes/Make.lib
--- atlas-3.8.3~/makes/Make.lib	2009-08-22 16:02:46.000000000 -0700
+++ atlas-3.8.3/makes/Make.lib	2009-08-22 21:28:16.000000000 -0700
@@ -3,10 +3,10 @@
 #
 # override with libatlas.so only when atlas is built to one lib
 #
-DYNlibs = liblapack.so libf77blas.so libcblas.so libatlas.so 
-PTDYNlibs = liblapack.so libptf77blas.so libptcblas.so libatlas.so 
-CDYNlibs = liblapack.so libcblas.so libatlas.so 
-CPTDYNlibs = liblapack.so libptcblas.so libatlas.so 
+DYNlibs = liblapack_atlas.so libf77blas.so libcblas.so libatlas.so 
+PTDYNlibs = liblapack_atlas.so libptf77blas.so libptcblas.so libatlas.so 
+CDYNlibs = liblapack_atlas.so libcblas.so libatlas.so 
+CPTDYNlibs = liblapack_atlas.so libptcblas.so libatlas.so 
 
 VER=3.8.3
 tarnam = atlas$(VER)_$(ARCH)
@@ -23,7 +23,7 @@
 	cp $(LIBdir)/libatlas.a $(ARCH)/lib/.
 	cp $(LIBdir)/libf77blas.a $(ARCH)/lib/.
 	cp $(LIBdir)/libcblas.a $(ARCH)/lib/.
-	cp $(LIBdir)/liblapack.a $(ARCH)/lib/.
+	cp $(LIBdir)/liblapack_atlas.a $(ARCH)/lib/.
 	- cp $(LIBdir)/libptcblas.a $(ARCH)/lib/.
 	- cp $(LIBdir)/libptf77blas.a $(ARCH)/lib/.
 	$(TAR) cf $(tarnam).tar $(ARCH)
@@ -32,28 +32,28 @@
 	mv $(tarnam).tar.gz $(tarnam).tgz
 
 ptshared :
-	- rm -f libatlas.so liblapack.so
-	$(MAKE) libatlas.so liblapack.so libptf77blas.so libf77blas.so \
-                libptcblas.so libcblas.so liblapack.so
+	- rm -f libatlas.so liblapack_atlas.so
+	$(MAKE) libatlas.so liblapack_atlas.so libptf77blas.so libf77blas.so \
+                libptcblas.so libcblas.so liblapack_atlas.so
 shared :
-	- rm -f libatlas.so liblapack.so
-	$(MAKE) libatlas.so liblapack.so libf77blas.so libcblas.so liblapack.so
+	- rm -f libatlas.so liblapack_atlas.so
+	$(MAKE) libatlas.so liblapack_atlas.so libf77blas.so libcblas.so liblapack_atlas.so
 cptshared :
-	- rm -f libatlas.so libclapack.so
-	$(MAKE) libatlas.so libclapack.so libptcblas.so libcblas.so
+	- rm -f libatlas.so libclapack_atlas.so
+	$(MAKE) libatlas.so libclapack_atlas.so libptcblas.so libcblas.so
 cshared :
-	- rm -f libatlas.so libclapack.so
-	$(MAKE) libatlas.so libclapack.so libcblas.so
+	- rm -f libatlas.so libclapack_atlas.so
+	$(MAKE) libatlas.so libclapack_atlas.so libcblas.so
 
 libatlas.so : libatlas.a
 	ld $(LDFLAGS) -shared -soname libatlas.so -o libatlas.so \
         --whole-archive libatlas.a --no-whole-archive -lc $(LIBS)
-liblapack.so : liblapack.a
+liblapack_atlas.so : liblapack_atlas.a
 	ld $(LDFLAGS) -shared -soname $@ -o $@ --whole-archive \
-           liblapack.a --no-whole-archive $(F77SYSLIB)
-libclapack.so : libclapack.a
-	ld $(LDFLAGS) -shared -soname liblapack.so -o liblapack.so \
-           --whole-archive libclapack.a
+           liblapack_atlas.a --no-whole-archive $(F77SYSLIB)
+libclapack_atlas.so : libclapack_atlas.a
+	ld $(LDFLAGS) -shared -soname liblapack_atlas.so -o liblapack_atlas.so \
+           --whole-archive libclapack_atlas.a
 libptf77blas.so : libptf77blas.a
 	ld $(LDFLAGS) -shared -soname $@ -o $@ --whole-archive libptf77blas.a \
            --no-whole-archive $(F77SYSLIB)
@@ -69,30 +69,30 @@
 #
 fat_ptshared :                              # threaded target
 	ld $(LDFLAGS) -shared -soname libatlas.so -o libatlas.so \
-        --whole-archive liblapack.a libptf77blas.a libptcblas.a libatlas.a \
+        --whole-archive liblapack_atlas.a libptf77blas.a libptcblas.a libatlas.a \
            --no-whole-archive -lc $(F77SYSLIB) $(LIBS)
 fat_shared :                                # unthreaded target
 	ld $(LDFLAGS) -shared -soname libatlas.so -o libatlas.so \
-        --whole-archive liblapack.a libf77blas.a libcblas.a libatlas.a \
+        --whole-archive liblapack_atlas.a libf77blas.a libcblas.a libatlas.a \
            --no-whole-archive -lc $(F77SYSLIB) $(LIBS)
 #
 # Builds shared lib, not include fortran codes from LAPACK
 #
-fat_cptshared : libclapack.a                # threaded target
+fat_cptshared : libclapack_atlas.a                # threaded target
 	ld $(LDFLAGS) -shared -soname libcatlas.so -o libcatlas.so \
-        --whole-archive libclapack.a libptcblas.a libatlas.a \
+        --whole-archive libclapack_atlas.a libptcblas.a libatlas.a \
         --no-whole-archive -lc $(LIBS)
-fat_cshared : libclapack.a                  # unthreaded target
+fat_cshared : libclapack_atlas.a                  # unthreaded target
 	ld $(LDFLAGS) -shared -soname libcatlas.so -o libcatlas.so \
-        --whole-archive libclapack.a libcblas.a libatlas.a \
+        --whole-archive libclapack_atlas.a libcblas.a libatlas.a \
         --no-whole-archive -lc $(LIBS)
 
-libclapack.a : liblapack.a
-	rm -rf clapack libclapack.a
+libclapack_atlas.a : liblapack_atlas.a
+	rm -rf clapack libclapack_atlas.a
 	mkdir clapack
-	cd clapack ; ar x ../liblapack.a
+	cd clapack ; ar x ../liblapack_atlas.a
 	rm -f clapack/*f77wrap* 
-	ar r libclapack.a clapack/ATL_* clapack/clapack_*
+	ar r libclapack_atlas.a clapack/ATL_* clapack/clapack_*
 	rm -rf clapack
 xtst_lp: $(DYNlibs)
 	$(ICC) $(CDEFS) -o $@ $(mySRCdir)/qr.c $(DYNlibs) -Wl,--rpath ./
